package com.tgu.home_action.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;

@Data
@TableName("memos")
@ApiModel(description = "备忘录")
public class Memo {
    public interface insert{
    }
    public interface update{
    }

    @NotNull(message = "id不能为空",groups = {update.class})
    @ApiModelProperty("备忘录ID")
    private Integer id;

    @NotNull(message = "title不能为空",groups = {insert.class})
    @ApiModelProperty("标题")
    private String title;

    @ApiModelProperty("内容")
    private String content;

    @ApiModelProperty("图片数组")
    private String imgUrl;

    @ApiModelProperty("发布者角色")
    private String role;

    @ApiModelProperty("志愿者ID")
    private Integer volunteerId;

    @ApiModelProperty("管理员ID")
    private Integer adminId;

    @ApiModelProperty("案件ID")
    private Integer caseId;

    @ApiModelProperty("姓名")
    private String name;

    @ApiModelProperty("头像")
    private String avatarUrl;

    @TableField(exist = false)
    @ApiModelProperty("是否返回全局")
    private Short includeGlobal;

    @ApiModelProperty("是否为全局(1为是，2为不是)")
    @NotNull(message = "isGlobal不能为空",groups = {insert.class})
    @Min(value = 1,message = "isGlobal只能是1或2",groups = {insert.class})
    @Max(value = 2,message = "isGlobal只能是1或2",groups = {insert.class})
    private Short isGlobal;

    @ApiModelProperty(value = "创建时间",dataType = "java.sql.Date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp createAt;

    @ApiModelProperty(value = "修改时间",dataType = "java.sql.Date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp updateAt;
}
